<?php
/*
 * Created on 2012-4-28
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
   error_reporting(E_ALL ^ E_NOTICE);
 include("../nncms_manager_inc.php");
 $action=$_GET["action"];
 $assest_id=$_GET["assest_id"];
 $assest_category_id=$_GET["assest_category_id"];
 $video_package_id=$_GET["video_package_id"];
 $video_category_id=$_GET["video_category_id"];
 $assest_category_name=$_GET["assest_category_name"];
 $video_category_name=$_GET["video_category_name"];
 include($nncms_db_path. "nns_assist/nns_db_assist_bind_class.php");
 $ajax_category_inst=new nns_db_assist_bind_class();
 if($action =='get_bind_product' || $action=='delete_product_content'|| $action=='delete_product_video'){
 		require_once $nncms_db_path. "nns_products".DIRECTORY_SEPARATOR . "nns_db_products_class.php";
	    $product_inst = new nns_db_products_class();
 }
 switch ($action){
 	case "add":
 		$result=$ajax_category_inst->nns_db_assest_bind_video_category_add($assest_id,$assest_category_id,$video_package_id,$video_category_id,$assest_category_name,$video_category_name);
 		echo json_encode($result);
 	break;
 	case "delete":
 		$result=$ajax_category_inst->nns_db_assest_bind_video_category_delete($assest_id,$assest_category_id,$video_package_id,$video_category_id);
 		echo json_encode($result);
 	break;
 	case "search":
 		$result=$ajax_category_inst->nns_db_assest_bind_video_category_list($assest_id,$assest_category_id);
 		echo json_encode($result);
 	break;
  	case "get_bind_product":
	    $bind_product = $product_inst->get_assist_category_bind_product($assest_id,$assest_category_id);
 		if(!$bind_product) $bind_product = array();
 		echo json_encode($bind_product);
 	break;

 	case "delete_product_content":
   		$result = $product_inst->delete_assist_bind_product($_GET["nns_id"]);
 		echo json_encode($result);
 	break;
 	case "delete_product_video":
	   	$result = $product_inst->delete_video_bind_product($_GET["nns_id"]);
 		echo json_encode($result);
 	break;

 }
?>